set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
Create TRIGGER [triggerDeleteGIAODICH]
   ON  [dbo].[GIAODICH]
   AFTER DELETE
AS 
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    INSERT INTO delGIAODICH
                      (SOCT, LOAICT, NGAYCT, MAKH, TIENHANG, VAT, PHIVC, CHIETKHAU, TONGTIEN, TIENMAT, CONGNO, THUNGAY, LOAITIEN, NameKH, DIACHIKH, DIENTHOAI, 
                      NOIDUNG, TINHTRANG, INHD, TAIKHOAN, NGANHANG, TINH_TP, CREATEBY, MODIFIEDBY, CREATEDATE, MODIFIEDDATE)
SELECT     SOCT, LOAICT, NGAYCT, MAKH, TIENHANG, VAT, PHIVC, CHIETKHAU, TONGTIEN, TIENMAT, CONGNO, THUNGAY, LOAITIEN, NameKH, DIACHIKH, DIENTHOAI, 
                      NOIDUNG, TINHTRANG, INHD, TAIKHOAN, NGANHANG, TINH_TP, CREATEBY, MODIFIEDBY, CREATEDATE, MODIFIEDDATE
FROM         deleted
END


set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
Create TRIGGER [triggerDeleteCONGNO]
   ON  [dbo].[CONGNO]
   AFTER DELETE
AS 
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    INSERT INTO delCONGNO
                      (ID, SOCT, NGAYCT, DIACHIKH, DIENTHOAI, PHAITHU, D_C, SOTIEN, NOIDUNG, MAKH, SOCTTT, CREATEBY, MODIFIEDBY, CREATEDATE, MODIFIEDDATE)
SELECT     ID, SOCT, NGAYCT, DIACHIKH, DIENTHOAI, PHAITHU, D_C, SOTIEN, NOIDUNG, MAKH, SOCTTT, CREATEBY, MODIFIEDBY, CREATEDATE, MODIFIEDDATE
FROM         deleted
END


set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
Create TRIGGER [triggerDeleteNXHANG]
   ON  [dbo].[NXHANG]
   AFTER DELETE
AS 
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

  INSERT INTO delNXHANG
                      (SOCT, LINE, LOAICT, NGAYCT, LOAIHANG, LOCATION, QUYCACH, DVTINH, SOLUONG, GIAVON, GIABAN, SOTIEN, TINHTRANG, XUATKHO)
SELECT     SOCT, LINE, LOAICT, NGAYCT, LOAIHANG, LOCATION, QUYCACH, DVTINH, SOLUONG, GIAVON, GIABAN, SOTIEN, TINHTRANG, XUATKHO
FROM         deleted
END


